
<?
	 layout("/inc/win_layout.html",{title:sysTitle}){
    ?>


<div class="panel ">
	<div class="panel-body pan" style="height: 280px">
		<form action="#" class="form-horizontal">
			<div class="form-body pal">
				<div class="row" style="margin-top:-15px; margin-bottom: 10px;">
					<div class="col-lg-6"
						style="width: 400px; float:left;  margin-right:-20px; display:inline;">
						<label for="inputUsername" class="col-md-3 control-label">中文名称
							<span class='require'>*</span> </label>
						<div class="col-md-9">
							<div class="input-icon">
								<input id="nameZh" type="text" class="form-control" value="" />
							</div>
						</div>
					</div>
					<div class="col-lg-6"
						style="width: 400px; float:left;  margin-right:-20px; display:inline;">
						<label for="inputUsername" class="col-md-3 control-label">英文名称
							<span class='require'>*</span> </label>
						<div class="col-md-9">
							<div class="input-icon">
								<input id="nameEn" type="text" class="form-control" value="" />
							</div>
						</div>
					</div>
					<div class="col-lg-6"
						style="width: 400px; float:left;  margin-right:-20px; display:inline;">
						<label for="inputUsername" class="col-md-3 control-label">排序
							<span class='require'>*</span> </label>
						<div class="col-md-9">
							<div class="input-icon">
								<input id="sort" type="text" class="form-control" value="" />
							</div>
						</div>
					</div>
					<div class="col-lg-6"
						style="width: 400px; float:left;  margin-right:-20px; display:inline;">
						<label for="inputUsername" class="col-md-3 control-label">描述</label>
						<div class="col-md-9">
							<div class="input-icon">
								<textarea id="description"  rows="3" cols="20" class="form-control" ></textarea> 
							</div>
						</div>
					</div>
				</div>
				<input id="id" type="hidden" class="form-control" />
		</form>
	</div>
</div>
<?} ?>
<script>
	var index1 = window.parent.getlay();
	var page = window.parent.getpage();
	$(function() {
		if (index1 != 0) {
			$("#id").val(index1);
			demo();
		} 
	});
	
	function Page() {
		if ($.trim($("#nameZh").val()).length < 1) {
			alert('中文名不能为空！');
			return null;
		}
		if ($.trim($("#nameEn").val()).length < 1) {
			alert('英文名不能为空！');
			return null;
		}
		if ($.trim($("#sort").val()).length < 1) {
			alert('排序不能为空！');
			return null;
		}
		
		$.ajax({
			type : "post",
			url : "addOrUploadWordModule.do",
			data : {
				"id" : index1,
				"nameZh" : $("#nameZh").val(),
				"nameEn" : $("#nameEn").val(),
				"sort" : $("#sort").val(),
				"description" : $("#description").val(),
			},
			dataType : "json",
			success : function(data) {
				var index = parent.layer.getFrameIndex(window.name);
				if(data[0].data == 'yes'){
					parent.layer.msg('提交成功');
				}else{
					parent.layer.msg('提交成功');
				}
				window.parent.demo(page);
				parent.layer.close(index);
				
			},
			error : function(data) {
				alert("请求失败");
			}
		});
	}
	function demo() {
		$.getJSON('queryWordModule.do', {
			id : index1
		//向服务端传的参数，此处只是演示
		}, function(res) {
			//此处仅仅是为了演示变化的内容
			$("#nameZh").val(res[0].nameZh);
			$("#nameEn").val(res[0].nameEn);
			$("#sort").val(res[0].sort);
			$("#description").val(res[0].description);
			$("#id").val(res[0].id);
		});
	};
</script>


